#ifndef HTTP_HEADER_VARIANT_SET_H
#define HTTP_HEADER_VARIANT_SET_H

#include <sparrow/http_header_callback.h>

/*
   request-header
        method
        uri
            schema
            user-info
            host
            port
            path
            query
            fragment
        version
        version-major
        version-minor
        headers 0
            header 0
                header
                name
                value
            ...
            header n
                header
                name
                value

   response-header
        version
        version-major
        version-minor
        status
        reason
        headers 0
            header 0
                header
                name
                value
            ...
            header n
                header
                name
                value
 
   */


class VariantSet;
class HttpHeaderVariantSet : public HttpHeaderCallback
{
    public:
        HttpHeaderVariantSet();
        virtual ~HttpHeaderVariantSet();
        VariantSet *release_header();

        const std::string *header(const std::string &name, const std::nothrow_t &) const;
        const std::string *header(const std::string &name) const;

    private:
        virtual void method(const Slice &method);
        virtual void request_uri(const Slice &uri,
                const Slice &schema,
                const Slice &user_info,
                const Slice &host,
                int port,
                const Slice &path,
                const Slice &query,
                const Slice &fragment);

        virtual void version(const Slice &version, int major, int minor);
        virtual void status(int code, const Slice &reason);
        virtual void header(const Slice &header, const Slice &name, const Slice &value);
        virtual void reset();

        VariantSet *header_;
        VariantSet *headers_;
};

#endif // HTTP_HEADER_VARIANT_SET_H

